Skip to content

[NativeAOT] fix NAOT mappings (follow-up to https://github.com/dotnet/runtime/pull/123333)#123831

Merged
rcj1 merged 5 commits intodotnet:mainfrom
rcj1:aot-mapping-fix-2
Feb 3, 2026
Merged

[NativeAOT] fix NAOT mappings (follow-up to https://github.com/dotnet/runtime/pull/123333)#123831
rcj1 merged 5 commits intodotnet:mainfrom
rcj1:aot-mapping-fix-2

Conversation

@rcj1
Copy link
Contributor

@rcj1 rcj1 commented Jan 31, 2026

Testing on #122722 revealed some issues with #123333 so I am fixing these here.

After #123333 there remain two error cases:

  1. Our IL offset is greater than the previously found offset, but lower than the max found offset. In this case, we would like to advance the line number in accordance with the new IL offset, which was omitted after [NativeAOT] Source to native mapping fix for out-of-order code #123333.
  2. Our IL offset is greater than the highest IL offset for which there exists a sequence point. In this case, we want to ensure we can create a native <-> line mapping - [NativeAOT] Source to native mapping fix for out-of-order code #123333 had left these IL offsets with a Document of null, meaning no mappings were possible.
    This fixes both of these issues.

Before:
Screenshot 2026-01-30 192451
Screenshot 2026-01-30 192408

After:
Screenshot 2026-01-30 190332
Screenshot 2026-01-30 190613
foo.txt
foo2.txt
New Compressed (zipped) Folder.zip

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

@rcj1 rcj1 requested a review from jkotas January 31, 2026 02:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines NativeAOT’s IL-to-native sequence point mapping to close gaps found after #123333, ensuring more accurate source line attribution in stack traces, especially for runtime-async scenarios described in #122722.

Changes:

  • Extend propagation of the last known document/line info across the entire temporary sequencePoints buffer so IL offsets beyond the last explicit sequence point still get a valid document/line mapping.
  • Replace the per-iteration previousIlOffset tracking with a maxIlOffset tracker and adjust the emission condition so sequence points are produced both when backed by PDB info and whenever the IL offset falls within or below the maximum IL offset seen so far, fixing cases where IL offsets re-enter earlier ranges.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MichalStrehovsky Could you please take a look as well?

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 2, 2026 21:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

…lysis/MethodCodeNode.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 2, 2026 22:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

@rcj1
Copy link
Contributor Author

rcj1 commented Feb 3, 2026

Hm, I have requested the pipeline be rerun but it is still “neutral” on many runs.

@jkotas
Copy link
Member

jkotas commented Feb 3, 2026

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas
Copy link
Member

jkotas commented Feb 3, 2026

I have requested the pipeline be rerun but it is still “neutral” on many runs.

There was an infra outage earlier today, the system may be still recovering from it.

@rcj1
Copy link
Contributor Author

rcj1 commented Feb 3, 2026

/ba-g timeouts

@rcj1 rcj1 merged commit e646a55 into dotnet:main Feb 3, 2026
118 of 125 checks passed
@rcj1 rcj1 deleted the aot-mapping-fix-2 branch February 3, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants